<html><head><title>Comic Press</title><base href="file:///C:/Documents%20and%20Settings/gvanore/Desktop/comicpress.html"></head><body><h1>Comic Press</h1>
<p>I think I should clarify and demonstrate what I mean when I talk
about a project to do comic management. When I say "AJAXian" backend, I
simply mean a service-oriented backend. That is, rather than have a
single page that mushes everything together, we clearly delineate
backend and frontend work.</p>
<h2>The Previous Way</h2>
The quick-and-dirty, commonplace method of web development that mashes application layers together.  Imagine a "comic.php:"
<p style="font-family: monospace;">
<font color="blue">&lt;?php<br>
&nbsp;include("/config.php");<br>
<font color="red">
&nbsp;$conn = mysql_connect(...);<br>
&nbsp;...<br>
</font>
?&gt;<br>
<font color="black">
&lt;html&gt;&lt;head&gt;...&lt;/head&gt;&lt;body&gt;...<br>
...<font color="blue">&lt;?php if ($something) { ?&gt;</font> ...<br>
&lt;/body&gt;&lt;/html&gt;</font></font>
</p>
<p>In this example, the blue is server-side scripting. The red is
database manipulation or querying, and the black is the presentation.
They are all intertwined.</p>
<h2>Another Way</h2>
<p>In a more service-oriented methodology, we build specific services
based on what we need to accomplish. The database operations become a
service which is separated from the view. Again, our "comic.php:"</p>
<p style="font-family: monospace; color: blue;">
&lt;?php<br>
&nbsp;include("/config.php");<br>
<font color="red">
&nbsp;$conn = mysql_connect(...);<br>
&nbsp;...<br></font>
?&gt;</p>
<p>The view has been stripped out completely from the back-end script.  Our new view, "comic.html:"</p>
<p style="font-family: monospace;">
&lt;html&gt; ...<br>
&nbsp;function onBodyLoad() {<br>
&nbsp;&nbsp;ajax = new XMLHttpRequest(initialLoadEvent);<br>
&nbsp;}<br>
...
</p>
<p>In this model, our client is scripted to use our backend like a service.  All view code is kept in a single place.</p>
<h2>Miscellaneous Notes</h2>
<ul>
<li>Using mod_rewrite, if available, the web site can be organized into
search-friendly urls such as "site.com/comics/2006/10/26/1" (as opposed
to "site.com/comic.php?year=2006&amp;month=10&amp;day=26&amp;item=1")</li>
<li>Once data services layer is defined, the website is completely
unbound from the back-end. This makes the front-facing and
administration pages user-serviceable.</li>
<li>A service-oriented approach means that the user interface is not
constrained to a single page. Separate viewers for disparate media
could be made, and there are no requirements that a viewer must be
written in HTML and Javascript. (E.g., at a later date, a flash
interface could be easily built and both could work at the same time.)</li>
<li><a href="http://json.org/">JSON</a> is an excellent candidate for the message format.  It works out of the box with Javascript/Actionscript.</li></ul></body></html>
